// module.exports = {
//   host: 'localhost',
//   user: 'root',
//   password: '',
//   database: 'shopmalldb',
//   charset: 'utf8mb4' // 添加这行统一字符集
// };
const mysql = require('mysql2/promise');

const pool = mysql.createPool({
  host: process.env.DB_HOST || 'localhost',
  user: process.env.DB_USER || 'root',
  password: process.env.DB_PASSWORD || '123456',
  database: process.env.DB_NAME || 'shopmalldb',
  waitForConnections: true,
  connectionLimit: 10,
  queueLimit: 0
});

module.exports = pool;